package com.goktech.sportsmall.controller;

import com.goktech.sportsmall.bean.CartBean;
import com.goktech.sportsmall.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Map;

@RestController
@RequestMapping("cart")
public class VueCartController {
    @Autowired(required = false)
    private CartService cartService;

    @GetMapping("selectList")
    public Map<String,Object> selectList(int page, int size, int uId,String cName,String cSort){
        return cartService.selectList(page,size,uId,cName,cSort);
    }

    @GetMapping("insertCart")
    public int insertCart(CartBean cartBean){
        return cartService.insertCart(cartBean);
    }

    @GetMapping("updateCount")
    public int updateUser(@RequestBody CartBean cartBean){ //@RequestBody
        return cartService.updateCount(cartBean);
    }

    @GetMapping("deleteCart")
    public int delUser(String csNo,int uId){ //@RequestBody
        return cartService.deleteCart(csNo,uId);
    }

}
